home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F24384_Company1MMPull.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  2.9 KB  |  79 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       OneToManyMany
  4.   Author:         David Silverlight
  5.                   HeadGeek@xmlpitstop.com
  6.   Created:        2001-05-16
  7.   Description:-
  8.     This stylsheet demonstrates a  1-M-M relationship of Company
  9.     to Category to Employees.  Also note that we are using the
  10.     Pull method to extract data from our xml document.  The pull
  11.     method is an approach where the use of templates is
  12.     minimized and data is  accessed ny 'pulling' it from our xml
  13.     document
  14. ================================================================ -->
  15. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  16.   <xsl:output method="html" />
  17.  
  18.   <xsl:template match="/">
  19.     <html>
  20.       <head>
  21.         <title>Stylesheet Example</title>
  22.         <style type="text/css"><![CDATA[
  23.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  24.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  25.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  26.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  27.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  29.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  30.         TR { background-color: beige; }
  31.         BODY { background-color: beige; }
  32.         ]]></style>
  33.       </head>
  34.  
  35.       <body bgcolor="beige">
  36.         <font face="arial">
  37.           <h1>Company Employee per Category listing for Infoteria</h1>
  38.           <xsl:for-each select="/Company/Category">
  39.             <span class="subhead">Category</span>
  40.             <font face="arial" size="3" color="Black">
  41.               <xsl:value-of select="@Name" />
  42.             </font>
  43.             <br />
  44.             <br />
  45.             <span class="subhead">Employee Listing</span>
  46.             <br />
  47.             <table border="1">
  48.               <tr>
  49.                 <th>Name</th>
  50.                 <th>Position</th>
  51.                 <th>Email</th>
  52.               </tr>
  53.               <xsl:for-each select="Employee">
  54.                 <tr>
  55.                   <td>
  56.                     <xsl:value-of select="FirstName" />
  57.                     <xsl:value-of select="LastName" />
  58.                   </td>
  59.                   <td>
  60.                     <xsl:value-of select="Position" />
  61.                   </td>
  62.                   <td>
  63.                     <xsl:value-of select="Email" />
  64.                   </td>
  65.                 </tr>
  66.               </xsl:for-each>
  67.             </table>
  68.             Total Employees:
  69.             <xsl:value-of select="count(Employee)" />
  70.             <br />
  71.             <br />
  72.           </xsl:for-each>
  73.           <br />
  74.         </font>
  75.       </body>
  76.     </html>
  77.   </xsl:template>
  78. </xsl:stylesheet>
  79.